{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">文章列表</div>
    <div class="layui-card-body">
        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li {empty name='Request.param.type'}class="layui-this"{/empty}><a href="{:url('publist',['id'=>$param.id])}">全部</a></li>
                <li {if $Request.param.type==1}class="layui-this"{/if}><a href="{:url('publist',['id'=>$param.id,'type'=>1])}">已采集</a></li>
                <li {if $Request.param.type==2}class="layui-this"{/if}><a href="{:url('publist',['id'=>$param.id,'type'=>2])}">已导入</a></li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form">
                        <table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
      <a class="layui-btn layui-btn-sm layui-btn-danger confirm layui-batch-all" data-href='{:url("content_del",["id"=>$param.id])}'>批量删除</a>
      {empty name="Request.param.type"}
      <a class="layui-btn layui-btn-sm layui-btn-warm" href="{:url('content_del',['id'=>$param.id,'type'=>'all'])}">全部清空</a>
      {/empty}
      {if $Request.param.type==1}
      <!--<a class="layui-btn layui-btn-sm">导入</a>-->
      <a class="layui-btn layui-btn-sm" href="{:url('import',['type'=>'all','id'=>$param.id])}">全部导入</a>
      {/if}
    </div>
</script>
<script type="text/html" id="barTool">
    <a class="layui-btn layui-btn-xs layui-btn-normal layui-iframe" href="{:url('show')}?id={{d.id}}">查看</a>
</script>
{/block}
{block name="script"}
<script>
layui.use('table', function() {
    var table = layui.table,
        $ = layui.$,
        form = layui.form;
    table.render({
        elem: '#dataTable',
        toolbar: '#toolbarDemo',
        url: '{:url("publist",$param)}',
        cols: [
            [
                { type: 'checkbox', fixed: 'left' },
                { field: 'status', title: '状态', width: 80,templet: '<div>{{#  if(d.status==1){ }} <button class="layui-btn layui-btn layui-btn-xs">已采集</button> {{#  } else { }} <button class="layui-btn layui-btn-danger layui-btn layui-btn-xs">已导入</button> {{#  } }} </div>' },
                { field: 'title', title: '标题' },
                { field: 'url', title: '网址' },
                { fixed: 'right', width: 80, title: '操作', toolbar: '#barTool' }
            ]
        ],
        page: {}
    });
});
</script>
{/block}